package com.three.controller;


import com.baor.baseUtil.R;
import com.three.domain.Attendance;
import com.three.domain.Businesstrips;
import com.three.domain.Dailylogs;
import com.three.domain.Leaves;
import com.three.service.DailyLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class DailyLogsController {
    @Autowired
    private DailyLogsService dailyLogsService;
//总端
    //日志列表
    @RequestMapping(value="/dailyLogsList")
    public R dailyLogsList(@RequestBody Map<String, Object> map) {
        String keyword = (String) map.get("keyword");
        int pageIndex = (int) map.get("pageIndex");
        int pageSize = (int) map.get("pageSize");
        String date = (String) map.get("date");
        return dailyLogsService.dailyLogsList(keyword,pageIndex, pageSize,date);
    }

    //出差列表
    @RequestMapping(value="/businesstripsList")
    public R businesstripsList(@RequestBody Map<String, Object> map) {
        String keyword = (String) map.get("keyword");
        int pageIndex = (int) map.get("pageIndex");
        int pageSize = (int) map.get("pageSize");
        String date = (String) map.get("date");
        return dailyLogsService.businesstripsList(keyword,pageIndex, pageSize,date);
    }

    //请假列表
    @RequestMapping(value="/leavesList")
    public R leavesList(@RequestBody Map<String, Object> map) {
        String keyword = (String) map.get("keyword");
        int pageIndex = (int) map.get("pageIndex");
        int pageSize = (int) map.get("pageSize");
        String date = (String) map.get("date");
        return dailyLogsService.leavesList(keyword,pageIndex, pageSize,date);
    }
    //考勤列表
    @RequestMapping(value="/attendanceList")
    public R attendanceList(@RequestBody Map<String, Object> map) {
        String keyword = (String) map.get("name");
        int pageIndex = (int) map.get("pageIndex");
        int pageSize = (int) map.get("pageSize");
        String date = (String) map.get("date");
        return dailyLogsService.attendanceList(keyword,pageIndex, pageSize,date);
    }
//教师端
        //日常列表
        @RequestMapping(value = "/dailyLogsListByTeacher")
        public R dailyLogsListByTeacher(@RequestBody  Map<String,Object> map){
            return dailyLogsService.dailyLogsListByTeacher(map);
        }
        //出差列表
        @RequestMapping(value = "/businesstripsListByTeacher")
        public R businesstripsListByTeacher(@RequestBody  Map<String,Object> map){
            return dailyLogsService.businesstripsListByTeacher(map);
        }
        //请假列表
        @RequestMapping(value = "/leavesListByTeacher")
        public R leavesListByTeacher(@RequestBody  Map<String,Object> map){
            return dailyLogsService.leavesListByTeacher(map);
        }
        //出勤列表
        @RequestMapping(value = "/attendanceListByTeacher")
        public R attendanceListByTeacher(@RequestBody  Map<String,Object> map){
            return dailyLogsService.attendanceListByTeacher(map);
        }
        //添加日常
        @RequestMapping(value = "/addDailyLogs")
        public R addDailyLogs(@RequestBody Dailylogs dailylogs){
            return dailyLogsService.addDailyLogs(dailylogs);
        }
        //添加出差
        @RequestMapping(value = "/addBusinesstrips")
        public R addBusinesstrips(@RequestBody Businesstrips businesstrips){
            return dailyLogsService.addBusinesstrips(businesstrips);
        }
        //添加请假
        @RequestMapping(value = "/addLeaves")
        public R addLeaves(@RequestBody Leaves leaves){
            return dailyLogsService.addLeaves(leaves);
        }

        @RequestMapping(value = "/addAttendance")
        public R addAttendance(@RequestBody Attendance attendance){
            return dailyLogsService.addAttendance(attendance);
        }

}
